/*****************************************************************************
 * Copyright (C) Stacy Curl. All rights reserved.                            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *****************************************************************************/
package example.verify.custom;

import picounit.features.verify.CombinedConstraints;
import picounit.features.verify.Evaluator;
import picounit.features.verify.constraint.Explanation;
import picounit.verify.BooleanArrayConstraints;
import picounit.verify.BooleanConstraints;
import picounit.verify.ByteArrayConstraints;
import picounit.verify.ByteConstraints;
import picounit.verify.CharacterArrayConstraints;
import picounit.verify.CharacterConstraints;
import picounit.verify.DoubleArrayConstraints;
import picounit.verify.FileConstraints;
import picounit.verify.FloatArrayConstraints;
import picounit.verify.FloatConstraints;
import picounit.verify.IntegerArrayConstraints;
import picounit.verify.IntegerConstraints;
import picounit.verify.LongArrayConstraints;
import picounit.verify.LongConstraints;
import picounit.verify.ShortArrayConstraints;
import picounit.verify.ShortConstraints;
import picounit.verify.StringArrayConstraints;
import picounit.verify.TypedArrayConstraints;
import picounit.verify.TypedConstraints;

import java.io.File;

public class FrogVerify extends Explanation implements FrogVerifyStage {
	private final CombinedConstraints constraints; 
	
	private final CustomDoubleConstraints customDoubleConstraints;
	private final CustomStringConstraints customStringConstraints;

	private final FrogConstraints frogConstraints;

	public FrogVerify(Evaluator evaluator) {
		super(evaluator);
		
		this.constraints = new CombinedConstraints(evaluator);

		this.customDoubleConstraints = new CustomDoubleConstraints(evaluator);
		this.customStringConstraints = new CustomStringConstraints(evaluator);
		this.frogConstraints = new FrogConstraints(evaluator);
	}
	
	///////////////////////////////////////////////////////////////////////////////////////////////
	// Custom constraint methods
	///////////////////////////////////////////////////////////////////////////////////////////////

	public CustomDoubleConstraints that(double value) {
		setValue(value);

		return customDoubleConstraints;
	}

	public CustomStringConstraints that(String value) {
		setValue(value);
		
		return customStringConstraints;
	}
	
	public FrogConstraints that(Frog frog) {
		setValue(frog);

		return frogConstraints;
	}

	///////////////////////////////////////////////////////////////////////////////////////////////
	// Default constraint methods
	///////////////////////////////////////////////////////////////////////////////////////////////

	public FrogVerifyStage because(String reason) {
		setReason(reason);

		return this;
	}
	
	public BooleanConstraints that(boolean value) {
		return constraints.constraintsFor(value);
	}

	public ByteConstraints that(byte value) {
		return constraints.constraintsFor(value);
	}
	
	public CharacterConstraints that(char value) {
		return constraints.constraintsFor(value);
	}
	
	public FloatConstraints that(float value) {
		return constraints.constraintsFor(value);
	}
	
	public IntegerConstraints that(int value) {
		return constraints.constraintsFor(value);
	}
	
	public LongConstraints that(long value) {
		return constraints.constraintsFor(value);
	}
	
	public ShortConstraints that(short value) {
		return constraints.constraintsFor(value);
	}
	
	public FileConstraints that(File value) {
		return constraints.constraintsFor(value);
	}
	
	@SuppressWarnings("unchecked")
	public <T> TypedConstraints<T> that(T value) {
		return constraints.constraintsFor(value);
	}
	
	public BooleanArrayConstraints that(boolean ... value) {
		return constraints.constraintsFor(value);
	}
	
	public ByteArrayConstraints that(byte ... value) {
		return constraints.constraintsFor(value);
	}
	
	public CharacterArrayConstraints that(char ... value) {
		return constraints.constraintsFor(value);
	}
	
	public DoubleArrayConstraints that(double ... value) {
		return constraints.constraintsFor(value);
	}
	
	public FloatArrayConstraints that(float ... value) {
		return constraints.constraintsFor(value);
	}
	
	public IntegerArrayConstraints that(int ... value) {
		return constraints.constraintsFor(value);
	}
	
	public LongArrayConstraints that(long ... value) {
		return constraints.constraintsFor(value);
	}
	
	public ShortArrayConstraints that(short ... value) {
		return constraints.constraintsFor(value);
	}
	
	public StringArrayConstraints that(String ... value) {
		return constraints.constraintsFor(value);
	}

	@SuppressWarnings("unchecked")
	public <T> TypedArrayConstraints<T> that(T ... value) {
		return constraints.constraintsFor(value);
	}	
}